<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css">
    <link rel="stylesheet" href="__PUBLIC__/static/css/style.css">
    <link rel="icon" href="__PUBLIC__/static/image/code.png">
</head>
<body class="body">
<div >
<div><a class="layui-btn site-demo-active layui-btn-sm" data-type="tabAdd" id="addwebconfig" data-href="{:url('admin/Webconfig/add')}">添加数据</a></div>

<table class="layui-table" lay-filter="parse-table-demo" id="test33" style="display:none">
  <thead>
    <tr>
      <th lay-data="{field:'id', width:50, sort: true}">ID</th>
      <th lay-data="{field:'groupid', width:50, sort: true,edit: 'text'}">分组</th>
      <th lay-data="{field:'name',align:'right', width:120,edit: 'text'}">字段信息</th>
      <th lay-data="{field:'value', width:200,edit: 'text'}">值</th>
      <th lay-data="{field:'varname', width:120,edit: 'text'}">字段名</th>
      <th lay-data="{field:'type', width:50,edit: 'text'}">类型</th>
      <th lay-data="{field:'typeval', width:250,edit: 'text'}">类型参数</th>
      <th lay-data="{field:'info', minwidth:150,edit: 'text'}">描述</th>
      <th lay-data="{field:'sort', width:60,edit: 'text', sort: true}">序</th>
    </tr> 
  </thead>
  <tbody>
{foreach $web as $key=>$vo} 
    <tr>
      <td>{$vo.id}</td>
      <td>{$vo.groupid}</td>
      <td>{$vo.name}</td>
      <td>{$vo.value}</td>
      <td>{$vo.varname}</td>
      <td>{$vo.type}</td>
      <td>{$vo.typeval}</td>
      <td>{$vo.info}</td>
      <td>{$vo.sort}</td>
    </tr>
{/foreach}
  </tbody>
</table>

</div>





<!-- 通用-970*90 -->
<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
<script src="__ADMIN__/js/comm.js" charset="utf-8"></script>
<script type="text/javascript">
layui.use(['form', 'table'], function() {
    var $ = layui.jquery,
        form = layui.form,
        table = layui.table;
    // you code ...
    table.init('parse-table-demo', { //转化静态表格
        height: '1000',
        page: false, limit:100
    });
    //监听单元格编辑
    table.on('edit(parse-table-demo)', function(obj) {
        //console.log('d','dss')
        var value = obj.value //得到修改后的值
            ,data = obj.data //得到所在行所有键值
            ,field = obj.field;
        json = eval('(' + '{"id":' + data.id + ',"' + field + '":"' + value + '"}' + ')');

        $.post('{:url('admin/Webconfig/quickedit')}', json,function(data) {
                if (data.code == 1) {
                    layer.msg(data.msg);
                }else{
                    layer.msg(data.msg);
                }
            });
    });
    $('#addwebconfig').click(function() {
        layer.open({
            type: 2,
            area: ['700px', '450px'],
            fixed: false, //不固定
            maxmin: true,
            content: $(this).attr('data-href')
        });
    })
    //iframe层-父子操作
});
</script>
</body>
</html>